﻿<Window x:Class="AssignmentsManage.Windows.CourseWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ext="clr-namespace:Xceed.Wpf.Toolkit;assembly=WPFToolkit.Extended"
        xmlns:dc="clr-namespace:AssignmentsManage.DataClasses"
        xmlns:ts="clr-namespace:AssignmentsManage.TemplateSelectors"
        xmlns:con="clr-namespace:AssignmentsManage.Converters"
        xmlns:setc="clr-namespace:SetCLib;assembly=SetCLib"
        xmlns:ctrl="clr-namespace:AssignmentsManage.Control"
        
        xmlns:Engine="clr-namespace:WPFLocalizeExtension.Engine;assembly=WPFLocalizeExtension"
        xmlns:lex="clr-namespace:WPFLocalizeExtension.Extensions;assembly=WPFLocalizeExtension"
        Engine:LocalizeDictionary.DesignCulture="en"
        
        Title="CourseWindow" Width="416" WindowStartupLocation="CenterOwner" SizeToContent="Height" ResizeMode="NoResize" xmlns:my="clr-namespace:AssignmentsManage.Windows" Loaded="Window_Loaded">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Styles/ListViewStyles.xaml" />
                <ResourceDictionary Source="../Styles/ButtonStyles.xaml" />
                <ResourceDictionary Source="../Styles/TextBoxStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
            
            <con:CamelCaseToWordsStringConverter x:Key="CamelCaseToWordsStringConverter1" />
            
            <ts:ListViewItemStyleAlternateSelector x:Key="ListViewItemStyleAlternateSelector1">
                <ts:ListViewItemStyleAlternateSelector.ListViewItemRow1>
                    <Style TargetType="{x:Type ListViewItem}">
                        <Style.Setters>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListViewItem}">
                                        <Border Height="28" Background="LightCyan">
                                            <GridViewRowPresenter />
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style.Setters>
                    </Style>
                </ts:ListViewItemStyleAlternateSelector.ListViewItemRow1>
                <ts:ListViewItemStyleAlternateSelector.ListViewItemRow2>
                    <Style TargetType="{x:Type ListViewItem}">
                        <Style.Setters>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListViewItem}">
                                        <Border Height="28">
                                            <GridViewRowPresenter />
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style.Setters>
                    </Style>
                </ts:ListViewItemStyleAlternateSelector.ListViewItemRow2>
            </ts:ListViewItemStyleAlternateSelector>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Label Content="{lex:LocText Key=lblCourseCode, Dict=Strings, Assembly=AssignmentsManage}" Height="28" HorizontalAlignment="Left" Margin="10,10,0,0" Name="label1" VerticalAlignment="Top" HorizontalContentAlignment="Right" />
        <Label Content="{lex:LocText Key=lblTitle, Dict=Strings, Assembly=AssignmentsManage}" Height="28" HorizontalAlignment="Left" Margin="10,54,0,0" Name="label2" VerticalAlignment="Top" HorizontalContentAlignment="Right" Width="75" />
        <Label Content="{lex:LocText Key=lblIDColour, Dict=Strings, Assembly=AssignmentsManage}" Height="28" HorizontalAlignment="Left" Margin="10,98,0,0" Name="label3" VerticalAlignment="Top" HorizontalContentAlignment="Right" Width="75" />
        <ctrl:LimitedTextBox Height="23" Margin="91,12,12,0" x:Name="txtCourseCode" VerticalAlignment="Top" Style="{StaticResource GeneralTextBox}" />
        <ctrl:LimitedTextBox Height="23" Margin="91,56,12,0" x:Name="txtTitle" VerticalAlignment="Top" Style="{StaticResource GeneralTextBox}" />
        <Button Content="{lex:LocText Key=btnCancel, Dict=Strings, Assembly=AssignmentsManage}" Height="23" HorizontalAlignment="Right" Margin="0,0,12,12" Name="btnCancel" VerticalAlignment="Bottom" Width="75" IsCancel="True" />
        <Button Content="{lex:LocText Key=btnOK, Dict=Strings, Assembly=AssignmentsManage}" Height="23" HorizontalAlignment="Right" Margin="0,0,93,12" Name="btnOK" VerticalAlignment="Bottom" Width="75" IsDefault="True" Click="btnOK_Click" />
        <ext:ColorPicker Margin="91,98,0,0" Height="25" VerticalAlignment="Top" HorizontalAlignment="Left" Width="104" Name="cpColourID" />
        <Expander Header="More Options" Margin="12,132,12,41" Name="expander1" IsExpanded="False">
            <TabControl Height="360" Name="tabControl1" Background="{x:Null}" AllowDrop="True" BorderThickness="1" BorderBrush="#FF030303" VerticalAlignment="Center">
                <TabItem Header="Schedule" Name="tabItem1">
                    <Grid>
                        <Label Content="Change the schedule for this course." FontFamily="Arial" FontSize="15" Foreground="{StaticResource TitleTextForegroundBrush}" Height="29" Margin="6,4,6,0" Name="label5" VerticalAlignment="Top" />
                    </Grid>
                </TabItem>
                <TabItem Header="Grade Distribution" Name="tabItem2">
                    <Grid>
                        <ListView Name="lstvGradeDist" Margin="6,38,6,28" BorderThickness="1" BorderBrush="#FF070707" ItemsSource="{Binding Path=ActivityWorths, RelativeSource={RelativeSource FindAncestor, AncestorType=my:CourseWindow, AncestorLevel=1}}" AlternationCount="1" ItemContainerStyleSelector="{StaticResource ListViewItemStyleAlternateSelector1}">
                            <ListView.View>
                                <GridView AllowsColumnReorder="False">
                                    <GridView.Columns>
                                        <GridViewColumn Header="Activity Type" Width="150">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate DataType="{x:Type dc:ActivityTypeWorth}">
                                                    <TextBlock Text="{Binding Path=ActivityType, Converter={StaticResource CamelCaseToWordsStringConverter1}}" VerticalAlignment="Center" />
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                        <GridViewColumn Header="% Of Total Grade" Width="100">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate DataType="{x:Type dc:ActivityTypeWorth}">
                                                    <ext:DecimalUpDown Value="{Binding Path=Worth}" Width="80" Minimum="0" Maximum="100" ValueChanged="DecimalUpDown_ValueChanged" />
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                    </GridView.Columns>
                                </GridView>
                            </ListView.View>
                        </ListView>
                        <Label Content="Change how much each type of activity is worth." FontFamily="Arial" FontSize="15" Foreground="{StaticResource TitleTextForegroundBrush}" Height="29" Margin="6,4,6,0" Name="label4" VerticalAlignment="Top" />
                        <TextBlock Height="19" Margin="6,0,6,6" Name="textBlock1" VerticalAlignment="Bottom">
                            <Run Text="Total: " /><Run Text="0%" Name="runTotalGradeDist" Foreground="Green" /><Run Text=" (should = 100% for grade distribution, otherwise leave 0%)" />
                        </TextBlock>
                    </Grid>
                </TabItem>
                <TabItem Header="Extra Information">
                    <Grid>
                        <Label Content="Add custom information about this course." FontFamily="Arial" FontSize="15" Foreground="{StaticResource TitleTextForegroundBrush}" Height="29" Margin="6,4,6,0" Name="label6" VerticalAlignment="Top" />

                        <ListView Name="lstvExtraInfo" Margin="6,38,6,28" BorderThickness="1" BorderBrush="#FF070707" AlternationCount="1" ItemContainerStyleSelector="{StaticResource ListViewItemStyleAlternateSelector1}" ItemsSource="{Binding Path=CustomProperties, RelativeSource={RelativeSource FindAncestor, AncestorType=my:CourseWindow, AncestorLevel=1}}">
                            <ListView.View>
                                <GridView AllowsColumnReorder="False">
                                    <GridView.Columns>
                                        <GridViewColumn Header="Title">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate DataType="{x:Type setc:TitleValueXML}">
                                                    <ctrl:LimitedTextBox Text="{Binding Path=Title}" VerticalAlignment="Center" Width="100" x:Name="txtExtraTitle" TextChanged="txtExtraTitle_TextChanged" Style="{StaticResource GeneralTextBox}" />
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                        <GridViewColumn Header="Content">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate DataType="{x:Type setc:TitleValueXML}">
                                                    <ctrl:LimitedTextBox Text="{Binding Path=Value}" VerticalAlignment="Center" Width="200" x:Name="txtExtraValue" TextChanged="txtExtraValue_TextChanged" Style="{StaticResource GeneralTextBox}" />
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                        <GridViewColumn Header="">
                                            <GridViewColumn.CellTemplate>
                                                <DataTemplate DataType="{x:Type setc:TitleValueXML}">
                                                    <Button x:Name="btnDeleteInfo" Height="20" Width="20" Template="{StaticResource ButtonImageTopStyle}" ToolTip="Delete this information" Click="btnDeleteInfo_Click">
                                                        <Image Source="/AssignmentsManage;component/Images/1342726110_delete.png" />
                                                    </Button>
                                                    <DataTemplate.Triggers>
                                                        <MultiDataTrigger>
                                                            <MultiDataTrigger.Conditions>
                                                                <Condition Binding="{Binding Path=Title}" Value="{x:Null}" />
                                                                <Condition Binding="{Binding Path=Value}" Value="{x:Null}" />
                                                            </MultiDataTrigger.Conditions>
                                                            <MultiDataTrigger.Setters>
                                                                <Setter TargetName="btnDeleteInfo" Property="Visibility" Value="Hidden" />
                                                            </MultiDataTrigger.Setters>
                                                        </MultiDataTrigger>
                                                        <MultiDataTrigger>
                                                            <MultiDataTrigger.Conditions>
                                                                <Condition Binding="{Binding Path=Title}" Value="{}" />
                                                                <Condition Binding="{Binding Path=Value}" Value="" />
                                                            </MultiDataTrigger.Conditions>
                                                            <MultiDataTrigger.Setters>
                                                                <Setter TargetName="btnDeleteInfo" Property="Visibility" Value="Hidden" />
                                                            </MultiDataTrigger.Setters>
                                                        </MultiDataTrigger>
                                                    </DataTemplate.Triggers>
                                                </DataTemplate>
                                            </GridViewColumn.CellTemplate>
                                        </GridViewColumn>
                                    </GridView.Columns>
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </Grid>
                </TabItem>
            </TabControl>
            <Expander.Style>
                <Style TargetType="{x:Type Expander}">
                    <Style.Triggers>
                        <EventTrigger RoutedEvent="Expanded">
                            <BeginStoryboard>
                                <Storyboard Storyboard.TargetProperty="Height">
                                    <DoubleAnimation From="30" To="390" Duration="0:00:0.3" AccelerationRatio="0.7" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="Collapsed">
                            <BeginStoryboard>
                                <Storyboard Storyboard.TargetProperty="Height">
                                    <DoubleAnimation From="390" To="30" Duration="0:00:0.3" AccelerationRatio="0.7" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Style.Triggers>
                </Style>
            </Expander.Style>
        </Expander>
    </Grid>
</Window>
